//**************************************************************************************************************
// CLASS: Label
//
// DESCRIPTION
// See comments in Label.hpp.
//
// AUTHOR INFORMATION
// Kevin R. Burger [KRB]
//   
// Mailing Address:
// Computer Science & Engineering
// School of Computing, Informatics, and Decision Systems Engineering
// Arizona State University
// Tempe, AZ 85287-8809
//
// Email: burgerk@asu
// Web:   http://kevin.floorsoup.com
//**************************************************************************************************************
#include "Label.hpp"

//==============================================================================================================
// PUBLIC FUNCTION MEMBERS
//==============================================================================================================

//--------------------------------------------------------------------------------------------------------------
// Default ctor.
//
// DESCRIPTION:
// Calls the base class Operand::Operand(string const&) ctor. Then stores pAddress into mAddress.
//--------------------------------------------------------------------------------------------------------------
Label::Label(std::string const& pName, Address const pAddress): Operand(pName), mAddress(pAddress)
{
}

//--------------------------------------------------------------------------------------------------------------
// Copy ctor.
//--------------------------------------------------------------------------------------------------------------
Label::Label(Label const& pLabel)
{
    Copy(pLabel);
}

//--------------------------------------------------------------------------------------------------------------
// Dtor.
//--------------------------------------------------------------------------------------------------------------
Label::~Label()
{
}

//--------------------------------------------------------------------------------------------------------------
// GetAddress()
//
// DESCRIPTION:
// mAddress accessor function.
//--------------------------------------------------------------------------------------------------------------
Address const Label::GetAddress() const
{
    return mAddress;
}

//--------------------------------------------------------------------------------------------------------------
// GetName()
//
// DESCRIPTION:
// Operand::mOpString accessor function.
//--------------------------------------------------------------------------------------------------------------
std::string Label::GetName() const
{
    return GetString();
}

//--------------------------------------------------------------------------------------------------------------
// operator=()
//--------------------------------------------------------------------------------------------------------------
Label& Label::operator=(Label const& pLabel)
{
    if (this != &pLabel) Copy(pLabel);
    return *this;
}

//--------------------------------------------------------------------------------------------------------------
// SetAddress()
//
// DESCRIPTION:
// mAddress mutator function.
//--------------------------------------------------------------------------------------------------------------
void Label::SetAddress(Address const pAddress)
{
    mAddress = pAddress;
}

//--------------------------------------------------------------------------------------------------------------
// SetName()
//
// DESCRIPTION:
// Operand::mOpString mutator function.
//--------------------------------------------------------------------------------------------------------------
void Label::SetName(std::string const& pName)
{
    SetString(pName);
}

//==============================================================================================================
// PROTECTED FUNCTION MEMBERS
//==============================================================================================================

//--------------------------------------------------------------------------------------------------------------
// Copy()
//
// DESCRIPTION:
// Makes 'this' Label a copy of pLabel.
//--------------------------------------------------------------------------------------------------------------
void Label::Copy(Label const& pLabel)
{
    // Copy the base class (Operand) data members to 'this'.
    Operand::Copy(pLabel);

    // Copy the derived class (Label) data members to 'this;.
    SetAddress(pLabel.GetAddress());
}

//==============================================================================================================
// PRIVATE FUNCTION MEMBERS
//==============================================================================================================
